package com.heima.test4;

public class BankAccount {
    private String accountNumber;
    private String accountHolder;
    private double balance;
    private static int totalAccounts=0;

    public BankAccount() {
        totalAccounts++;
    }

    public BankAccount(String accountNumber, String accountHolder, double balance) {
        this.accountNumber = accountNumber;
        this.accountHolder = accountHolder;
        this.balance = balance;
        totalAccounts++;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getAccountHolder() {
        return accountHolder;
    }

    public void setAccountHolder(String accountHolder) {
        this.accountHolder = accountHolder;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }
    public void deposit(double money){
        if (money<=0){
            System.out.println("请放钱");
        }else {
            balance+=money;
        }

    }
    public void withdraw(double money){
        if (money<=0){
            System.out.println("快输入钱数");
        }else {
            balance-=money;
        }

    }
    public static int getTotalAccounts(){
        return totalAccounts;
    }

}
